<?php

namespace app\shop\validate;

class OrderValidate extends BaseValidate
{
    protected $rule = [
        'id'            => 'require',
        'type'          => 'require|in:1,2',
        'goods_id'      => 'require',
        'sku_id'        => 'require',
        'num'           => 'require',
        'address_id'    => 'require',
        'goods'         => 'require',
        'pay_way'       => 'require|in:wxpay,balance,alipay',
        'cart_id'       => 'require',
        'cancel_reason' => 'require',
    ];

    protected $message = [
        'id.require'         => '订单ID不能为空',
        'type.require'       => '订单类型不能为空',
        'type.in'            => '订单类型错误',
        'sku_id.require'     => '规格ID不能为空',
        'num.require'        => '购买数量不能为空',
        'goods_id.require'   => '商品ID不能为空',
        'address_id.require' => '收货地址ID不能为空',
        'goods.require'      => '商品信息不能为空',
        'pay_way.require'    => '支付方式不能为空',
        'pay_way.in'         => '支付方式错误',
        'cart_id'            => '购物车ID不能为空',
        'cancel_reason'      => '取消原因不能为空',
        'refund_type'        => '退款类型不能为空',
    ];

    protected $scene = [
        'pre'          => ['sku_id', 'num', 'address_id'],
        'pre_cart'     => [''],
        'pre_purchase' => ['id'],
        'create'       => ['goods', 'type', 'address_id'],
        'pay'          => ['id', 'pay_way'],
        'list'         => [''],
        'detail'       => ['id'],
        'delete'       => ['id'],
        'cancel'       => ['id'],
        'receive'      => ['id'],
        'delivery'     => ['id'],
        'pay_notify'   => ['id'],
    ];
}
